﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using JAAF.Collections;

namespace JAAF.UI
{
    /// <summary>
    /// A dictionary that contain <see cref="IView">views</see>.
    /// </summary>
    public class ViewDictionary: KeyedCollection<string, IView>
    {

        protected override string GetKeyForItem(IView _oItem)
        {
            return _oItem.Name;
        }

        /// <summary>
        /// Returns a <see cref="ReadOnlyDictionary<IView>"/> with the
        /// views of this dictionary
        /// </summary>
        /// <returns></returns>
        public ReadOnlyKeyedCollection<string, IView> AsReadOnly()
        {
            return new ReadOnlyKeyedCollection<string, IView>(this);
        }
    }
}
